﻿using Newtonsoft.Json.Linq;
using System;
using System.Windows;
using System.Windows.Controls;

namespace wpf_print.view
{
    internal class TitleView
    {

        public static Grid GeTitleView(JObject item, JObject codeIfo)
        {
            Grid grid = new();
            //  一行两列
            RowDefinition rd = new();
            grid.RowDefinitions.Add(rd);
            for (var i = 0; i < 2; ++i)
            {

                ColumnDefinition cd = new();
                grid.ColumnDefinitions.Add(cd);
            }

            System.Windows.Controls.Image img = CreatCodeQR.CreateQRCode(codeIfo["moreData"]["ackInfo"]["sequence"] + "p" + codeIfo["page"]["pageNum"], new Thickness(20, 0, 0, 0));
            img.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            WrapPanel warPanel = BoxView.GetBoxView(item);
            warPanel.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            Grid.SetRow(warPanel, 0);
            Grid.SetColumn(warPanel, 0);
            Grid.SetRow(img, 0);
            Grid.SetColumn(img, 1);
            grid.Children.Add(warPanel);
            grid.Children.Add(img);
            grid.ClipToBounds = false;
            return grid;


        }
    }
}
